--if isClient() then
--    return
--end
ESR = ESR or {}
ESR.Logger = ESR.Logger or {}

function ESR.Logger.convertToBrackets(list)
    function concat(text, newText)
        local nt = "[" .. newText .. "]"
        if text == "" then
            return nt
        else
            return text .. " " .. nt
        end
    end

    local result = ""
    for i, text in ipairs(list) do
        result = concat(result, text)
    end
    return result
end

function ESR.Logger.write(logType, module, messages)
    local logEntries = {}
    table.insert(logEntries, logType)
    table.insert(logEntries, module)
    if messages then
        for i, m in ipairs(messages) do
            table.insert(logEntries, m)
        end
    end

    writeLog(ESR.Rankings.Shared.MODULE_NAME, ESR.Logger.convertToBrackets(logEntries))
end

function ESR.Logger.info(module, messages)
    ESR.Logger.write("INFO", module, messages)
end

function ESR.Logger.error(module, messages)
    ESR.Logger.write("ERROR", module, messages)
end
